from PyQt5.QtWidgets import QApplication, QWidget, QPushButton
from PyQt5.QtGui import QPainter, QPixmap
import sys
from PyQt5 import QtCore
from PyQt5.QtGui import QIcon


class Ui_MainWindow(object):


    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(800, 600)
        self.centralwidget = QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        painter = QPainter(self)
        pixmap = QPixmap("../resources/bg/background.png")
        painter.drawPixmap(self, pixmap)
        # # 创建按钮
        # self.button = QPushButton(self)
        # self.button.setGeometry(200, 150, 100, 100)  # 按钮大小
        # self.button.setIcon(QIcon("../resources/logo.ico"))  # 按钮图标
        # self.button.setIconSize(self.button.size())  # 图标填充按钮
        # self.button.setStyleSheet("border: none; background: transparent;")  # 去掉边框
        # self.button.clicked.connect(self.on_click)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "哔哩哔哩运营辅助系统-寰宇科技"))


    def on_click(self):
        print("按钮被点击了！")

    def paintEvent(self, event):
        painter = QPainter(self)
        pixmap = QPixmap("../resources/bg/background.png")
        painter.drawPixmap(self, pixmap)

if __name__ == "__main__":
    app = QApplication(sys.argv)
    MainWindow = QWidget()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())